<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<body>
    <div>
        用户名<input type="text" id="username"><br>
        密  码<input type="text" id="password"><br>
        <input type="button" value="提交" onclick="login()">
    </div>
</body>

<script>
    function login() {
        var name = document.getElementById("username").value;
        var password = document.getElementById("password").value;

        $.ajax({
            url:"/login",
            data:{name:name,password:password},
            type:"post",
            dataType:"json",
            success:function (data) {
                if(data.result == 'success'){
                    window.open(data.url, '_self');
                }else{
                    // 处理报错
                    window.open('list', '_self');
                }
            }
        })
    }
</script>
</html>